﻿@model IEnumerable<Common.UserProductFault>

@{
    ViewBag.Title = "ItemFaultDetail";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<script type="text/javascript">
    function OnSuccess() {
        alert("Detail Printed!")
    }

    
    function OnFailure() {
        alert("Something went Wrong!!")
    }  
</script>




<h2>ItemFaultDetail</h2>
<div id="ProductDetail">
    @Html.Partial("_Product","Website");
</div>
<table>
    <tr>
        <th>
            Fault ID
        </th>
        <th>
            Date
        </th>
        <th>
            Fault Detail
        </th>
        <th>
            Status
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.ID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Date)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.FaultDetail)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Fault.Fault1)
        </td>
    </tr>
}
</table>

@using (Ajax.BeginForm("Printing","Product", new AjaxOptions() { HttpMethod = "POST", OnSuccess = "OnSuccess", OnComplete = "OnSuccess" }))
{
    <input id="BtnPrint" type="submit" value="Print" />
}
